package com.example.onlineeducation.mapper

import com.example.onlineeducation.data.entity.FileEntitiy
import com.example.onlineeducation.data.json.OfflineExamRecordListJson
import com.example.onlineeducation.data.model.OfflineExamRecordDataModel
import com.yc.jetpacklib.extension.ycToNoEmpty
import com.yc.jetpacklib.mapper.IMapper

/*
* 线下考试记录列表
* */
class OfflineExamRecordListMapper : IMapper<OfflineExamRecordListJson, OfflineExamRecordDataModel> {
    override fun map(input: OfflineExamRecordListJson): OfflineExamRecordDataModel = OfflineExamRecordDataModel(
        input.id,
        input.avatar.ycToNoEmpty(),//头像
        input.personName.ycToNoEmpty(),//姓名
        input.personTypeName.ycToNoEmpty(),//工种类型
        input.isPass.ycToNoEmpty(),//考试结果状态（0-未通过，1-已通过，-1=未考试）
        input.point,//考试分数
        input.costTime,//答题时长
        input.testDate,//考试日期
        input.groupName.ycToNoEmpty(),//班组名
        input.webPathList?.map { //卷面图
            FileEntitiy(it?.webPath)
        }
    )
}
